doctype 5
html ->
  head ->
    meta charset: 'utf-8'
    meta(name: 'viewport', content:'width=device-width, initial-scale=1.0')
    title if @title? then "#{@title} In tucao" else "在吐槽"
    meta(name: 'description', content: @description) if @description?
    link(rel: 'canonical', href: @canonical) if @canonical?

    ie 'lt IE 9', ->
      script src: "http://html5shim.googlecode.com/svn/trunk/html5.js"
    link href: '/css/t.css', rel: 'stylesheet'
    script src: "/js/j.js?v1.7"
    #link rel: 'shortcut icon', href: 'images/favicon.ico'
    #link rel: 'apple-touch-icon', href: 'images/apple-touch-icon.png'
    #link rel: 'apple-touch-icon', sizes: '72x72', href: 'images/apple-touch-icon-72x72.png'
    #link rel: 'apple-touch-icon', sizes: '114x114', href: 'images/apple-touch-icon-114x114.png'
  body ->
    div class: 'navbar navbar-fixed-top', ->
      div class: 'navbar-inner', ->
        div class: 'container-fluid', ->
          a class: 'btn btn-navbar', 'data-toggle': 'collapse', 'data-target': '.nav-collapse', ->
            span class: 'icon-bar'
            span class: 'icon-bar'
            span class: 'icon-bar'
          a class: 'brand', href:'/', 'Tucao'
          div class: 'btn-group pull-right', ->
            if @user
              a class: 'btn dropdown-toggle', 'data-toggle':'dropdown', href:'#', ->
                i class: 'icon-user'
                text "#{ @user.nickname }"
                #span class: 'caret'
              ul class:'dropdown-menu', ->
                form id:"form_signout", method:"POST", action:"/signout/", ->
                  li -> a id:"navbar_logout", href:'#', '登出'
                #li class: 'divider'
            else
              form id:"login-inline", method:"POST", action:"/signin/", class:"form-inline", ->
                div class:"input-prepend", ->
                  span class:"add-on", -> i class:"icon-envelope"
                  input name:"email", class:"input-medium", placeholder:"Email"
                div class:"input-prepend input-append", ->
                  span class:"add-on", -> i class:"icon-chevron-right"
                  input name:"password", type:"password", class:"input-small",  placeholder:"Password"
                  button type:"submit", class:"btn", "登录"
                #label class:"checkbox", ->
                #  input name:"remenber", type:"checkbox"
                #  text "记住我"
                  a href:"/signup/", class:"btn btn-info", "注册"

          #div class: 'nav-collapse', ->
          #  ul class: 'nav', ->
          #    li class: 'active', ->
          #      a href: '/connect/qplus/ed/', 'Englinsh ED'
          #    #li ->
          #    #  a href: '/connect/qplus/ed/', 'Englinsh ED'

    div class: 'container-fluid', ->
      div class: 'row-fluid', ->
        div class: 'span3', ->
          div class: 'well sidebar-nav', ->
            ul class:'nav nav-list', ->
              if @tags
                li class:'nav-header', -> h3 '全部节点'
                for i in @tags
                  li ->
                    a href: "/t/#{i.url}", "#{i.name}"
            if @nodes
              ul class:'nav nav-list', ->
                li class:'nav-header', -> h3 '最近吐槽'
                for i in @nodes
                  li -> a href: "/#{i}", i

        div class: 'span9', ->
          div class: 'hero-unit', ->
            @body
  script ->
    """var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-32231884-1"]),_gaq.push(["_trackPageview"]),function(){var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b)}();$("#navbar_logout").click(function(){$("#form_signout").submit(); return false;});"""
  script src: "/js/favorit.js?v1.7"
